package com.main;

import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class ConversationFrame {
	BitmapFont font;
	Sprite background;
	int stringId;
	int maxStrings;
	public boolean visible;
	String[] strings;
	public enum DisplayType {Talk, Listen};
	public DisplayType currentType;
	public ConversationFrame() {
		font = new BitmapFont();
		font.scale(1);
	}
	public void setStrings(String[] strings) {
		this.strings = strings;
		stringId = 0;
		maxStrings = strings.length;
		currentType = DisplayType.Listen;
	}
	public void setTalkOptions(String[] strings) {
		this.strings = strings;
		currentType = DisplayType.Talk;
	}
	public void show() {
		visible = true;
	}
	public void hide() {
		visible = false;
	}
	public void render(SpriteBatch sb) {
		//background.draw(sb);
		if (currentType == DisplayType.Listen) {
			font.drawMultiLine(sb, strings[stringId],20, 200);
		} else if (currentType == DisplayType.Talk) {
			float ypos = 200;
			for (int i = 0; i < strings.length;i++) {
				font.drawMultiLine(sb, (i+1) + ". " + strings[i], 20, ypos);
				ypos = ypos-font.getMultiLineBounds(strings[i]).height;
			}
		}

	}
	public void setNext() {
		stringId++;
		if (stringId >= maxStrings)
			visible = false;
	}
}
